<%--
 *  File:    UserEdit.jsp
 *  @Author: kenfang 
 *  Date:    2010/07/10
 *
 *  Copyright (C) 2000 - 2010 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java"%>
<%@ page import="java.util.*"%>
<%@ page import="org.apache.log4j.Category"%>

<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval"%>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom"%>
<%
  //init param
  	Category cat = Category.getInstance("jsp.UserEdit");    
  	cat.debug("into jsp!");
	String strModuleName = "UPM";
	String privilegeCode = "Z0102,L401";
    String contextPath = request.getContextPath();
%>



<%
  	String dateFormat = (String)session.getAttribute("dateformat");
  	if(dateFormat==null)
  		dateFormat = "yyyy-MM-dd";
  //get curuserinfo
  
  HashMap CurUserInfo = (HashMap)session.getAttribute("userinfo");
  String strCurOrgName = (String)CurUserInfo.get("orgname");  
  String strEmployeeId = (String)request.getParameter("employeeid");
  String strisnew=(String)request.getParameter("isnew");
  String strIsCanUpdatePassword = new String("");
  //String strIssalesman = new String("");
  String strIscomments = new String("");
  
  Integer nExpireDays = null;	 
  
  if (strisnew==null)
        strisnew="Y";
  boolean bReadOnly = false;
  boolean bIsEdit = false;
  if(strEmployeeId != null && strisnew.equalsIgnoreCase("N"))
  {
    bIsEdit = true;
    
  }
  else
  {
    strEmployeeId = "";
  }
  
  boolean bIsNew = false;
	if(request.getParameter("userid") == null)
	{
  	bIsNew = true;
	}
	String strDisplayFlag="";
	if(request.getParameter("displayflag")!=null)
	{
	  strDisplayFlag=request.getParameter("displayflag");
	}
%>
<%@ include file="/inc/Security.inc"%>
<%@ include file="/inc/PageDefault.inc"%>

<html>
<head>
<title></title>
<PageFlow:CheckPageFlow pageName="useredit" />
<%@ include file="/inc/InitEdit.inc"%>

<%
  HashMap employeeInfo = (HashMap)pageContext.getAttribute("userinformation");
  Integer  isplay = (Integer) pageContext.getAttribute("isplay");
  String Strisplay = isplay + "";

  Integer employeeTypeValue = (Integer)pageContext.getAttribute("employeetype");
  if(employeeInfo == null)
  {
    employeeInfo = new HashMap();
 
  }else{
	  bReadOnly = true;
  }
  String isusesystem = "N";
  //String issalesman = "N";
  String iscomments = "N";
  Integer strUserId=(Integer)employeeInfo.get("userid")==null?new Integer(-1):(Integer)employeeInfo.get("userid");
  Integer strParentUserId=(Integer)employeeInfo.get("parentuserid")==null?new Integer(-1):(Integer)employeeInfo.get("parentuserid");
  
  isusesystem = (String)employeeInfo.get("isusesystem") == null ? "N" : "Y";
  //issalesman = (String)employeeInfo.get("issalesman") == null ? "N" : "Y";
  iscomments = (String)employeeInfo.get("comments") == null ? "N" : "Y";
  boolean haspassword = isusesystem.equals("Y");
  cat.debug("The employeeInfo is :" + employeeInfo); 
	String entryDate = OvalTools.dateToString(employeeInfo.get("entrydate"), dateFormat);
	String leaveDate = OvalTools.dateToString(employeeInfo.get("leavedate"), dateFormat);
  String birthDate = OvalTools.dateToString(employeeInfo.get("birthday"), dateFormat);
  String strPasswordStartDate = OvalTools.dateToString(employeeInfo.get("passwordstartdate"), dateFormat);
  String strPasswordExpiredDate = OvalTools.dateToString(employeeInfo.get("passwordexpiredate"), dateFormat);
  HashMap defaultAddress = (HashMap)pageContext.getAttribute("homeaddress");
  nExpireDays = (Integer)employeeInfo.get("passwordexpiredays");
  strIsCanUpdatePassword = employeeInfo.get("canupdatepassword") == null ? "" : ((String)employeeInfo.get("canupdatepassword")).equalsIgnoreCase("Y") ? "checked" : "";
  //strIssalesman = employeeInfo.get("issalesman") == null ? "" : ((String)employeeInfo.get("issalesman")).equalsIgnoreCase("Y") ? "checked" : "";
  strIscomments = employeeInfo.get("comments") == null ? "" : ((String)employeeInfo.get("comments")).equalsIgnoreCase("Y") ? "checked" : "";
  if(defaultAddress == null)
  {
    defaultAddress = new HashMap();
  } 
  cat.debug("The defaultAddress is :" + defaultAddress);

  Vector addrcities = (Vector)pageContext.getAttribute("addrcities");
  if(addrcities == null)
    addrcities = new Vector();
  cat.debug("The addrcities is :" + addrcities);
  
  Vector addrreceivers = (Vector)pageContext.getAttribute("addrreceivers");
  if(addrreceivers == null)
    addrreceivers = new Vector();
  cat.debug("The addrreceivers is :" + addrreceivers);
 
  Vector addrlines = (Vector)pageContext.getAttribute("addrlines");
  if(addrlines == null)
    addrlines = new Vector();
  cat.debug("The addrlines is :" + addrlines);
  Integer nAddrId = (Integer)defaultAddress.get("addressid");
  boolean bAddrNew = false;
  if(nAddrId == null)
    bAddrNew = true;

  Integer nContentId0 = null;
  String strCityCN = new String("");
  Integer nContentId1 = null;
  String strCityEN = new String("");
  Integer nContentId2 = null;
  String strAddrLineCN = new String("");
  Integer nContentId3 = null;
  String strAddrLineEN = new String("");
  Integer nContentId4 = null;
  String strAddrReceiverEN = new String("");
  Integer nContentId5 = null;
  String strAddrReceiverCN = new String("");
  if(addrcities.size() == 2)
  for(int j = 0;j < addrcities.size();j++)
  {
    HashMap hashTemp = (HashMap)addrcities.elementAt(j);
    if(((String)hashTemp.get("languagecode")).equalsIgnoreCase("cn"))
    {
      nContentId0 = (Integer)hashTemp.get("contentid");
      strCityCN = (String)hashTemp.get("content");
    }
    if(((String)hashTemp.get("languagecode")).equalsIgnoreCase("en"))
    {
      nContentId1 = (Integer)hashTemp.get("contentid");
      strCityEN = (String)hashTemp.get("content");       
    }
  }  
  if(addrlines.size() == 2)  
  for(int k = 0;k < addrlines.size();k++)
  {
    HashMap hashTemp = (HashMap)addrlines.elementAt(k);
    if(((String)hashTemp.get("languagecode")).equalsIgnoreCase("cn"))
    {
      nContentId2 = (Integer)hashTemp.get("contentid");
      strAddrLineCN = (String)hashTemp.get("content");
    }
    if(((String)hashTemp.get("languagecode")).equalsIgnoreCase("en"))
    {
      nContentId3 = (Integer)hashTemp.get("contentid");
      strAddrLineEN = (String)hashTemp.get("content");       
    }
  }    
  
  if(addrreceivers.size() == 2)  
  for(int l = 0;l < addrreceivers.size();l++)
  {
    HashMap hashTemp = (HashMap)addrreceivers.elementAt(l);
    if(((String)hashTemp.get("languagecode")).equalsIgnoreCase("cn"))
    {
      nContentId4 = (Integer)hashTemp.get("contentid");
      strAddrReceiverCN = (String)hashTemp.get("content");
    }
    if(((String)hashTemp.get("languagecode")).equalsIgnoreCase("en"))
    {
      nContentId5 = (Integer)hashTemp.get("contentid");
      strAddrReceiverEN = (String)hashTemp.get("content");       
    }
  }    
    
  Vector alldepartmentSelect = (Vector)pageContext.getAttribute("alldepartment");
  if(alldepartmentSelect == null)
  {
    alldepartmentSelect = new Vector();
  } 
  cat.debug("The alldepartmentSelect is :" + alldepartmentSelect);
  Vector allgenderSelect = (Vector)pageContext.getAttribute("allgender");
  if(allgenderSelect == null)
  {
    allgenderSelect = new Vector();
  } 
  cat.debug("The allgenderSelect is :" + allgenderSelect);
  Vector alljobtitleSelect = (Vector)pageContext.getAttribute("alljobtitle");
  if(alljobtitleSelect == null)
  {
    alljobtitleSelect = new Vector();
  } 
  cat.debug("The alljobtitleSelect is :" + alljobtitleSelect);
  Vector alleducationlevelSelect = (Vector)pageContext.getAttribute("alleducationlevel");
  if(alleducationlevelSelect == null)
  {
    alleducationlevelSelect = new Vector();
  } 
  cat.debug("The alleducationlevelSelect is :" + alleducationlevelSelect);
  Vector allmarriagestatusSelect = (Vector)pageContext.getAttribute("allmarriagestatus");
  if(allmarriagestatusSelect == null)
  {
    allmarriagestatusSelect = new Vector();
  } 
  cat.debug("The allmarriagestatusSelect is :" + allmarriagestatusSelect);
  Vector allofficeaddrSelect = (Vector)pageContext.getAttribute("allofficeaddr");
  if(allofficeaddrSelect == null)
  {
    allofficeaddrSelect = new Vector();
  } 
  cat.debug("The allofficeaddrSelect is :" + allofficeaddrSelect);  
  Vector allstatusSelect = (Vector)pageContext.getAttribute("allstatus");
  if(allstatusSelect == null)
  {
    allstatusSelect = new Vector();
  }
  Vector allregionSelect = (Vector)pageContext.getAttribute("allregion");
  Vector allcountrySelect = (Vector)pageContext.getAttribute("allcountry");
  if(allcountrySelect == null)
  {
    allcountrySelect = new Vector();
  } 
  cat.debug("The allcountrySelect is :" + allcountrySelect);
  if(allregionSelect == null)
  {
    allregionSelect = new Vector();
  } 
  cat.debug("The allregionSelect is :" + allregionSelect);   
  Object password = CurUserInfo.get("password");
  String flag = "";
  if(password != null){
	  flag = "has";
  }
%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css"
	type="text/css">
<script language="JavaScript" src="../../js/FuncLib.js"></script>
<script language="JavaScript" src="../../js/ScriptLib.js"></script>

<%
    HashMap userinfo=(HashMap)session.getAttribute("userinfo");
    Integer booksetid=null,neworgid=null;
    if(userinfo!=null)
    booksetid=(Integer)userinfo.get("booksetid");
    neworgid=(Integer)userinfo.get("orgid");

%>
<script language="JavaScript">
var needcheckaddress = false;
function changeAddress()
{
  if(frm.defaultaddess.value==true)
    return;
  if(document.frm.countrycode.value == "-1")
  {
    document.all.item("c0").className = "td-text";
    document.all.item("c1").className = "td-text";
    document.all.item("cn").className = "td-text";
    document.all.item("rn").className = "td-text";
    document.all.item("zc").className = "td-text";
   
    document.frm.regioncode.value = "";
    document.frm.regionname.value = "";
    document.frm.zipcode.value = "";

    document.frm.countrycode.isnull= "Y";
    document.frm.regioncode.isnull= "Y";
    document.frm.regionname.isnull = "Y";
    document.frm.ac0.command="cannull";
    document.frm.zipcode.isnull= "Y";
    needcheckaddress = false;
  }else{
    document.all.item("c0").className = "need";
    document.all.item("c1").className = "td-text";
    document.all.item("cn").className = "need";
    document.all.item("rn").className = "need";
    document.all.item("zc").className = "need";

    document.frm.countrycode.isnull = "N";
    document.frm.regioncode.isnull = "N";
    document.frm.regionname.isnull = "N";
    document.frm.ac0.command="notnull";
    document.frm.zipcode.isnull = "N";
    needcheckaddress = true;
  }
}
function page_changecountry()
{
	document.frm.regioncode.value = "";
  	document.frm.regionname.value = "";
	document.frm.zipcode.value = "";
  	for(var i=0;i<Number(frm.numrows.value);i++)
  	{
    	var obj1=eval("frm.ac"+i);
    	var obj2=eval("frm.al1"+i);
    	obj1.value="";
    	obj2.value="";
  	}
  	frm.defaultaddess.value=false;
  	changeAddress();
}
function page_setRegion(code,name)
{
  
  document.frm.regioncode.value = code;
  document.frm.regionname.value = name;
  var remote = window.open("","newwindow");
  if (remote != null)
    remote.close();
}

function selectRegion()
{
  if(document.frm.countrycode.value != "-1")
  {
    url = "../ogm/RegionSelect.jsp?<%= OvalTools.randomURL() %>&countrycode=" + document.frm.countrycode.value + "&languagecode=" + "<%= strLanguageCode %>";
    popup(url,"newwindow", "height=250, width=600,top=100,left=100,toolbar=n0, menubar=no, scrollbars=no, resizable=no, location=no, status=no");
  }
  else
  {
    alert("<%= message.getMessageDesc("MUST_SELECT_FIRST",label.getLabelName("L_CountryName",false)) %>");
    return;
  }
}

function checkEmployeeInfo(form)
{
  if(form.employeename.value.length < 0 || form.employeename.value.length > 20)
  {
    alert("Employeename Name is invalid!");
    return false;
  }  

  if(!isEmpty(form.email.value) && Trim(form.email.value)!=""  ) 
  {
      if(!emailCheck(form.email.value,false))
      {
        alert("<%= message.getMessageDesc("ILLEGAL_FORMAT", "E-mail") %>");
        return false;        
      }
  }  
	
  return true;
}

function page_done()
{
    //alert(document.frm.userqty.value);
    if(!isEmpty(document.frm.userqty.value)){
     if(!isPositive(document.frm.userqty.value)){
      alert("<%= message.getMessageDesc("VALUE_MUST_BE_POSITIVE",label.getLabelName("L_Userqty",false)) %>");
      document.frm.userqty.focus();
      return;
     }
    }
   var zipcode=document.frm.zipcode.value;
   //(frm.userid.value==null)||(frm.userid.value.length <= 0)||(frm.userid.value=="null")
   //alert(document.frm.countrycode.value);
   if(document.frm.countrycode.value == -1){
     document.frm.countrycode.value="";
     //alert(document.frm.countrycode.value);
   }
   
   if(!(document.frm.countrycode.value == null || document.frm.countrycode.value == "") ){
    if(zipcode==null || zipcode!=""){
     if(zipcode.length!=6){
      alert("请输入六位数字的邮编");
      return;
      }	
    }
   }
  	//changeAddress();
  	if(!checkForm(document.frm))return;
  	if(!checkEmployeeInfo(document.frm))
    	return;
  	if(!checkNull(document.frm))
  		return; 
  	if(!checkForm(document.frm))
  		return;  
  	MLCSTransform(frm);
  	emptyToNull(frm);
  	var isusesystem = document.frm.isusesystem.value;
	if(document.frm.isusesystemflag.checked)
  	{
    	document.frm.isusesystem.value = "Y";
  	}
  	else
  	{
    	document.frm.isusesystem.value = "N";  
  	}
	if(isusesystem == 'Y'){
		if(!checkPassword()){
			return;
		}     
	}
  	if(document.frm.passwordflag.checked)
  	{
    	document.frm.canupdatepassword.value = "Y";
  	}
  	else
  	{
    	document.frm.canupdatepassword.value = "N";  
  	}
    	//issalesman
    /*if(document.frm.issalesmanflag.checked)
    {
      document.frm.issalesman.value = "Y";
    }else
    {
      document.frm.issalesman.value = "N";  
    }
    */
   if(document.frm.commentsflag.checked)
    {
      document.frm.comments.value = "Y";
    }else
    	{
      	document.frm.comments.value = "N";  
    	}
  	selectCheck(document.frm);
  	
  	var employeeTypeValue = document.frm.employeetype.value;
  	
  	/*if(employeeTypeValue == 2){
  		var isbaleValue = document.frm.isbale.value;
  		if(isbaleValue == 0 ){
         alert("请选择是否承包");
         return ;
  		}
  }*/
  	//employeecode	
  	
  	if(employeeTypeValue == 1){
  		var employeecodeValue = document.getElementById("codeId").value;
  	  	if(employeecodeValue != null && employeecodeValue == " "){
  	  	alert("员工代码不能为空");
  		return ;
  	  	}
  	}
  	
   var userid=document.frm.userid.value;
   var parentuserid =document.frm.parentuserid.value;
   //alert(userid+' '+parentuserid);
   if(!isEmpty(userid)){
        if(userid == parentuserid ){
        alert("<%=message.getMessageDesc("Superior_Employees_Cannot_Be_Yourself")%>");
        return;
        }
   }
	var entrydate=dateCheck(frm.entrydate.value, 'yyyy-MM-dd', '<%= dateFormat %>');
	var leavedate  = dateCheck(frm.leavedate.value, 'yyyy-MM-dd', '<%= dateFormat %>');	
	if(leavedate.length>0)
      document.frm.status.value=28; 
   if(leavedate.length>0) {
	if(leavedate<entrydate)
    {
      	alert('<%=message.getMessageDesc("CAN_NOT_LATE_THAN",label.getLabelName("L_Begindate",false),label.getLabelName("L_Enddate",false))%>');
      	return;
    }
   }
  	document.frm.actionname.value = "done";
  	document.frm.target = "_self";
  	//isRunning = true;
  	//document.frm.submit();
  	  formatDate(frm);
     __submitData("pageform",true);
}
var isnew = <%= bIsNew %>;
function checkPassword(){
	if(isnew || (!isnew && !isEmpty(document.frm.password.value))){
		if((document.frm.password.value.length > 16) || (document.frm.password.value.length < 4)){
	      	alert("<%= message.getMessageDesc("LENGTH_MUST_BETWEEN",label.getLabelName("L_Password",false),"4", "16") %>");
	      	return false;
	    }	
	    if(isCharsInBag(document.frm.password.value,"0123456789")){
		  	alert("<%= message.getMessageDesc("VALUE_MUST_NOT_BE_ALL_NUMBER",label.getLabelName("L_Password",false)) %>");
			return false;
		}
	}
		
	
	if(frm.password.value != frm.passwordconfirm.value)
  	{
    	alert("<%= message.getMessageDesc("DIFFERENT_PASSWORD") %>");
    	return false;
  	}
  	
  	return true;
}

function poporg()
{
  window.open("OrgSelect.jsp?<%= OvalTools.randomURL() %>&selectoption=owner&languagecode=<%= strLanguageCode %>", "newwindow", "height=250, width=600,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no");
}
function page_setOrg(id,name,code)
{
  document.frm.orgid.value = id;
  document.frm.orgname.value = name;
  document.frm.orgcode.value = code;

  document.frm.action = "EmployeeEdit.jsp?<%= OvalTools.randomURL() %>";
  document.frm.target = "_self";
  isRunning = true;				//Do not forget this line
  document.frm.submit();
}

function page_orgchange()
{
  document.frm.action = "EmployeeEdit.jsp?<%= OvalTools.randomURL() %>";
  document.frm.target = "_self";
  isRunning = true;				//Do not forget this line
  document.frm.submit();
}


function page_setGLAccount(glaccountid,accountname,accountcode)
{
     frm.glaccountid.value=  glaccountid;
     frm. accountname.value= accountname;
     frm. accountcode.value= accountcode;

}
function page_getGLAccountname()
{

     frm.glaccountid.value="";
     frm.accountname.value="";
     if(frm.accountcode.value!="")
     {
         <%if(neworgid!=null){%> frm.neworgid.value=<%=JspHelper.filterNull(neworgid)%>;<%}%>
         <%if(booksetid!=null){%> frm.booksetid.value=<%=JspHelper.filterNull(booksetid)%>;<%}%>
         frm.schema.value="ovglaccountsummary";
         frm.qlname.value="selectforreload";
         page_handleRequest('<%=contextPath%>',frm);
     }
}
function page_handleResponse()
{
    frm.glaccountid.value = getResponseData("glaccountid");
    frm.accountname.value = getResponseData("accountname");
}

function parentemppop()
{
                                                                       
  window.open("EmployeeSelect.jsp?<%= OvalTools.randomURL() %>&selectoption=owner&languagecode=<%= strLanguageCode %>&employeeid="+document.frm.employeeid.value, "newwindow", "height=250, width=600,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no");
}
function page_setEmployee(id,name,code)
{ 
  document.frm.parentemployeeid.value = id;
  document.frm.parentemployeecode.value = name;
  document.frm.parentemployeename.value = code;
  document.frm.action = "EmployeeEdit.jsp?<%= OvalTools.randomURL() %>";
  document.frm.target = "_self";
  isRunning = true;				//Do not forget this line
  document.frm.submit();
}
function  reload_parentemp(){
 document.frm.parentemployeeid.value = "";
 document.frm.parentemployeename.value = "";
 if( isEmpty(document.frm.parentemployeecode.value))
   return;
 var  datahandler = new  DataHandler() ;
 datahandler.add_params("orgid" , document.frm.orgid.value,"Integer");
 datahandler.add_params("employeeid" , document.frm.employeeid.value,"Integer");
 datahandler.add_params("parentemployeecode" , document.frm.parentemployeecode.value,"String") ;
 datahandler.getResult("employeeid","document.frm.parentemployeeid"); 
 datahandler.getResult("employeename","document.frm.parentemployeename"); 
 datahandler.add_job("getparentemp") ;
 datahandler.runDataHandler ();
}	

function setPasswordTable(){
	var table = document.getElementById('passwordtable');
	var password = document.getElementById('pwn');
	var passwordconfirm = document.getElementById('pwc');
	
	var passwordText = document.getElementById('pwnt');
	var passwordconfirmText = document.getElementById('pwct');
	
	if(table.style.display == 'none'){
		table.style.display = 'block';	
		password.className = 'need';
		passwordconfirm.className = 'need';
		passwordText.isnull = 'N';
		passwordconfirmText.isnull = 'N';
		document.frm.isusesystem.value = 'Y';
	}else {
		table.style.display = 'none';
		password.className = 'td-text';
		passwordconfirm.className = 'td-text';
		passwordText.isnull = 'Y';
		passwordconfirmText.isnull = 'Y';
		document.frm.isusesystem.value = 'N';
	}
}

function showPassword(){
	var isusesystem = document.frm.isusesystem.value;
	if(isusesystem == 'Y'){
		document.frm.isusesystemflag.checked = 'checked';
		setPasswordTable();
	}
}



function page_cleancode(type){
	var  datahandler = new  DataHandler();
	if(type == 'emp'){
		if(frm.parentusername.value == ''){
			frm.parentusername.value = '';
			frm.parentemployeename.value = '';
			frm.parentuserid.value = '';
		}else{
			datahandler.add_params("username" , frm.parentusername.value);
			datahandler.add_params("languagecode" , '<%=strLanguageCode%>');
			datahandler.getResult("username","frm.parentusername"); 
			datahandler.getResult("employeename","frm.parentemployeename"); 
			datahandler.getResult("userid","frm.parentuserid"); 
			datahandler.add_job("j_getuserbycode");
		}
	}
			
	
	if(type == 'area'){
		if(frm.areacode.value == ''){
			frm.areacode.value = '';
			frm.areaname.value = '';
			frm.areaid.value = '';
		}else{
			datahandler.add_params("areacode" , frm.areacode.value);
			datahandler.add_params("grade" , "top");
			datahandler.getResult("areacode","frm.areacode"); 
			datahandler.getResult("areaname","frm.areaname"); 
			datahandler.getResult("areaid","frm.areaid"); 
			datahandler.add_job("j_getareainfobycode");
		}
	}

	datahandler.runDataHandler();	
}
function page_selectUser() {
		var status = "height=400, width=600,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
		var url = "<%=contextPath%>/img/UserSelectPop.jsp?o_thread=" + Math.random();
			
		if (typeof popwindow != 'undefined') popwindow.close();
		popwindow = window.open(url, "newwindow", status);
}


function history_watch()
{
  		var status = "height=600, width=800,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no";
		var url = "<%=contextPath%>/masterdata/upm/SalesHistoryPop.jsp?userid=<%=strUserId%>&o_thread=" + Math.random();
			
		if (typeof popwindow != "undefined") popwindow.close();
		popwindow = window.open(url, "newwindow", status);
  	
}

function page_setUser(id,code,name){
	document.frm.parentuserid.value=id;
	document.frm.parentusername.value=code;
	document.frm.parentemployeename.value=name;
}

function checkdate(){
	var birthday=dateCheck(frm.birthday.value, 'yyyy-MM-dd', '<%= dateFormat %>');
	var entrydate=dateCheck(frm.entrydate.value, 'yyyy-MM-dd', '<%= dateFormat %>');
	var passwordstartdate = dateCheck(frm.passwordstartdate.value, 'yyyy-MM-dd', '<%= dateFormat %>');
	var passwordexpiredate = dateCheck(frm.passwordexpiredate.value, 'yyyy-MM-dd', '<%= dateFormat %>');
	var leavedate  = dateCheck(frm.leavedate.value, 'yyyy-MM-dd', '<%= dateFormat %>');
	if(birthday < 0){
		frm.birthday.value = '';
		alert('<%= message.getMessageDesc("VALUE_MUST_BE_DATE", label.getLabelName("L_Birthday",false))%>' + '(<%=JspHelper.filterNull( dateFormat )%>)');
		frm.birthday.focus();
		return;
	}
	
	if(entrydate < 0){
		frm.entrydate.value = '';
		alert('<%= message.getMessageDesc("VALUE_MUST_BE_DATE", label.getLabelName("L_Begindate",false))%>' + '(<%=JspHelper.filterNull( dateFormat )%>)');
		frm.entrydate.focus();
		return;
	}
	
	if(passwordstartdate < 0){
		frm.passwordstartdate.value = '';
		alert('<%= message.getMessageDesc("VALUE_MUST_BE_DATE", label.getLabelName("L_PasswordStartDate",false))%>' + '(<%=JspHelper.filterNull( dateFormat )%>)');
		frm.passwordstartdate.focus();
		return;
	}
	
	if(passwordexpiredate < 0){
		frm.passwordexpiredate.value = '';
		alert('<%= message.getMessageDesc("VALUE_MUST_BE_DATE", label.getLabelName("L_PasswordExpireDate",false))%>' + '(<%=JspHelper.filterNull( dateFormat )%>)');
		frm.passwordexpiredate.focus();
		return;
	}
	
	if(leavedate < 0){
		frm.leavedate.value = '';
		alert('<%= message.getMessageDesc("VALUE_MUST_BE_DATE", label.getLabelName("L_Enddate",false))%>' + '(<%=JspHelper.filterNull( dateFormat )%>)');
		frm.leavedate.focus();
		return;
	}
}

function popBusinessarea(){
    //url = "UserAreaAllWindow.jsp?<%= OvalTools.randomURL() %>";
    url = "UserStdAreaAllWindow.jsp?<%= OvalTools.randomURL() %>";
    attribute = "height=400, width=650,top=100,left=100,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no";

	popwindow = window.open(url,"newwindow", attribute);
}

function set_orgNameByAreaWindow(id,areaname){
	document.frm.businessareaid.value=id;
	document.frm.businessareaname.value=areaname;
}

function page_checkNullStr(obj){
	var str=obj.value;
	str = ( str || "" ).replace(/^\s+|\s+$/g, "");
	str = ( str || "" ).replace(/^\��+|\��+$/g, "");
	obj.value=str;
}

 function page_showRow(){
  var employeeTypeValue = document.frm.employeetype.value;
   if(employeeTypeValue == 1){
   document.getElementById("codeId").readOnly = false;
   document.getElementById("isshow").style.display = "block";
  //document.getElementById("isbaleId").disabled = false;
   document.getElementById("codeId").style.border = "1px solid #7F9DB9";
 //document.getElementById("isbaleLabelId").style.color = "#000000";
   }else if(employeeTypeValue == 2){
	   document.frm.jobtitlecode.value = 1;
	   //document.frm.employeecode.value = "";
	   document.getElementById("isshow").style.display = "block";s
	   //document.getElementById("isbaleLabelId").style.color = "red";
	   //document.getElementById("isbaleId").disabled = false;
	   document.getElementById("codeId").style.border = "0px solid ";
	   document.getElementById("codeId").readOnly = true;
	 
    }
 }
 
  function yesornoBusinessarea(){
   //var issalesmanflag = document.frm.issalesmanflag.value;
   //alert(document.frm.issalesmanflag.checked);command="notnull" 
   /*
   if(document.frm.issalesmanflag.checked == true){
     document.getElementById("isBusinessArea").style.color = "red";
     document.frm.businessareaname.command="notnull";
   }else 
   {
	   document.getElementById("isBusinessArea").style.color = "#000000";
	   document.frm.businessareaname.command="";
    }
    */
 }
 
 function isCheckChange(){
	 var employeeTypeValue = document.frm.employeetype.value;
	 if(employeeTypeValue == 2){
     var jobtitleValue = document.frm.jobtitlecode.value;
     if(jobtitleValue != 1 ){
      //alert("员工类型为编外，只能选择销售代表");
      alert("<%=message.getMessageDesc("Staff_Types_Of_knitted_Can_Only_Choose_Sales_Representative")%>");
      document.frm.jobtitlecode.value = 1;
      }
    } 
 }

function getCheckedYesOrNo(){
	
	   var employeeTypeValue = document.frm.employeetype.value;
	   if(employeeTypeValue == 2){
	   var isbaleValue = document.frm.isbale.value;
	   if(document.getElementById("isusesystemID").checked){
	   if(isbaleValue == 2){
		   document.getElementById("isusesystemID").checked = false; 
	       document.getElementById("isusesystemID").disabled = true ;
      }else{
    	  document.getElementById("isusesystemID").disabled = false ;
         }
	   }else{
		   if(isbaleValue == 2){
		      document.getElementById("isusesystemID").disabled = true ;
	      }else{
	    	  document.getElementById("isusesystemID").disabled = false ;
	         }
		   }
	   
	}
 }
 
 function popWindowsContactRelation(){
	if ((frm.userid.value==null)||(frm.userid.value.length <= 0)||(frm.userid.value=="null")){
	
	
    	alert("<%=message.getMessageDesc("SAVE_INFO_FIRST")%>");
    	
        return;
    }
	//var issalesmanflag = frm.issalesmanflag;
	var userid = frm.userid.value;
	//if (!document.frm.issalesmanflag.checked){
		var url = "ContactRelationPopWindow.jsp?"+"<%= OvalTools.randomURL() %>"+"&usrid="+userid;
		var windowAttribute = "height=400, width=600,top=100,left=100, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=yes";
		if(popwindow!=null) popwindow.close();
	 	popwindow = window.open(url,null,windowAttribute);
	//}else{
		//alert("<%=message.getMessageDesc("Maintenance_Only_Non-business")%>");
	//}
}

function popWindowsContactProd(){
	if ((frm.userid.value==null)||(frm.userid.value.length <= 0)||(frm.userid.value=="null")){
	
	
    	alert("<%=message.getMessageDesc("SAVE_INFO_FIRST")%>");
    	
        return;
    }
	var userid = frm.userid.value;
	//var zmylcategory = frm.zmylcategory.options[frm.zmylcategory.selectedIndex].value;
	/*if(!document.frm.issalesmanflag.checked)
	{
		alert("<%=message.getMessageDesc("Not_Allowed_To_Add_Non-business")%>");
		return;
	}*/

	var url = "contactProdPopWindow.jsp?"+"<%= OvalTools.randomURL() %>"+"&usrid="+userid+"&isbottom=1";

	var windowAttribute = "height=400, width=600,top=100,left=100, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=yes";
	if(popwindow!=null) popwindow.close();
 	popwindow = window.open(url,null,windowAttribute);
 	
 	
 	//window.open("contactProdPopWindow.jsp?<%= OvalTools.randomURL() %>&isbottom=1&employeeid=<custom:write name="emplinfo" property="employeeid"/>", "newwindow", "height=400, width=600,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no")
}

function showPasswordinfo(){
	var flag = '<%=flag%>';
	if(flag){
		var table = document.getElementById('passwordtable');
		table.style.display = 'block';	
	}
	
}

function popWindowsContactProdinfo(){

	var userid = frm.userid.value;
	
	/*
	if(!document.getElementById("issalesmanflag").checked)
	{
		//alert("非业务人员不允许添加产品");
		alert("<%=message.getMessageDesc("Not_Allowed_To_Add_Non-business")%>");
		return;
	}
    */
	var url = 'contactProdPopWindow.jsp?'+'<%= OvalTools.randomURL() %>'+'&usrid='+userid+'&isbottom=1&isview=1';

	var windowAttribute = "height=400, width=600,top=100,left=100, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=yes";
	if(popwindow!=null) popwindow.close();
 	popwindow = window.open(url,null,windowAttribute);
 	
 	
}

 function popWindowsContactRelationinfo(){
	//var issalesmanflag = frm.issalesmanflag;
	var userid = frm.userid.value;
		var url = "ContactRelationPopWindow.jsp?"+"<%= OvalTools.randomURL() %>"+"&usrid="+userid+'&isview=1';
		var windowAttribute = "height=400, width=600,top=100,left=100, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=yes";
		if(popwindow!=null) popwindow.close();
	 	popwindow = window.open(url,null,windowAttribute);
		//alert("<%=message.getMessageDesc("Maintenance_Only_Non-business")%>");
}

 function deptWindowsContactRelation(){
	  var userid = frm.userid.value;
	  var url = "ContactRelationDeptWindow.jsp?"+"<%= OvalTools.randomURL() %>"+"&employeeid="+userid;
	  var windowAttribute = "height=400, width=600,top=100,left=100, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=yes";
	  if(popwindow!=null) popwindow.close();
	  popwindow = window.open(url,null,windowAttribute);
 }
  function deptWindowsContactRelationinfo(){
	  var userid = frm.userid.value;
	  var url = "ContactRelationDeptWindow.jsp?"+"<%= OvalTools.randomURL() %>"+"&employeeid="+userid+'&isview=1';
	  var windowAttribute = "height=400, width=600,top=100,left=100, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=yes";
	  if(popwindow!=null) popwindow.close();
	  popwindow = window.open(url,null,windowAttribute);
 }
</script>

</head>
<%if((strDisplayFlag).equals("view")){%>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<script>
  showPasswordinfo();
</script>
<%}else{ %>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<%} %>

<table width="100%" cellspacing="0" cellpadding="0">
	<tr>
		<td class="summary_top"></td>
	</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="0">
	<form id="pageform"  name="frm" method="post" action="<%=contextPath %>/Dispatcher"><input
		type=hidden name=numrows value='<%= ConstantProp.multiLangNumber %>'>

	<input type="hidden" name="pagename" value="useredit"> <input
		type="hidden" name="actionname"> <input type="hidden"
		name="languagecode" value="<%= strLanguageCode %>"> <input
		type="hidden" name="employeeid"
		value="<%=JspHelper.filterNull( employeeInfo.get("employeeid") )%>"> <input
		type="hidden" name="userid"
		value="<%=JspHelper.filterNull( employeeInfo.get("userid") )%>"> <input
		type="hidden" name="addressname"
		value="<%=JspHelper.filterNull( new String("HomeAddress") )%>"> <input
		type="hidden" name="defaultaddess"
		value="<%=JspHelper.filterNull( !defaultAddress.isEmpty() )%>" /> <input
		type="hidden" name="orgid"
		value="<%=JspHelper.filterNull( request.getParameter("orgid") )%>"> <input
		type="hidden" name="addressroletype"
		value="<%=JspHelper.filterNull( new Integer(11) )%>"> <input
		type="hidden" name="isprimary"
		value="<%=JspHelper.filterNull( new String("Y") )%>"> <input
		type="hidden" name="oldparentuserid" value="<%=strParentUserId%>"> <!-- <input type="hidden" name="employeecode"/> -->
	<tr>
		<td valign="top">
		<table border="1" cellspacing="0" bordercolorlight="#999999"
			bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="3">
			<%if(!(strDisplayFlag).equals("view")){%>
			<tr>
				<td colspan="4" class="td_right"><a onclick="page_done()"><custom:button
					type="2" label="L_Save" imgsrc="save_btn.gif" border="0" /></a></td>
			</tr>
			<%}%>
			<!-- 
			<tr>
				<td colspan="4" class="deepblue-left"><img
					src="../../images/<%= strLanguageCode %>/quote.gif"> <%= label.getLabelName("L_BasicInfo") + label.getLabelName("L_Colon") %>
				</td>
			</tr>
		     -->
			<tr>
				<td width="108" class="td-text"><%= label.getLabelName("L_UserCode") + label.getLabelName("L_Colon") %>
				</td>
				<td width=""><custom:text property="username" name="userinformation"
					size="20" label="L_UserCode" style="border:0;width:100%"
					readonly="true" /></td>
			    <%if(!(strDisplayFlag).equals("view")){%>
				<td class="td-text" width="108"><%= label.getLabelName("L_DefaultDeptName") + label.getLabelName("L_Colon") %>
				</td>
				<%if( employeeInfo.get("employeeid")==null) {%>
				<td width="228" id="isbaleId">
				  <!--<custom:select optionsName="alldepartment" optionValueKey="deptid" optionInnerTextKey="deptname" name="userinformation" property="deptid" defaultValue="----------" command="notnull" label="L_DefaultDeptName"/>-->
				  <!--  
				  <a onclick="javascript:deptWindowsContactRelation();"> 
					 <custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0" />
				  </a> -->&nbsp;
				</td>
				<%}else{ %>
				<td width="228" id="isbaleLabelId">
				  <!--<custom:select optionsName="alldepartment" optionValueKey="deptid" optionInnerTextKey="deptname" name="userinformation" property="deptid" defaultValue="----------" command="notnull" label="L_DefaultDeptName"/>-->
				  
				  <a onclick="javascript:deptWindowsContactRelation();"> 
					 <custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0" />
				  </a> 
				</td>
				<%} %>
				<%}else{ %>
                 <td class="td-text" width="106" ><%= label.getLabelName("L_DefaultDeptName") + label.getLabelName("L_Colon") %> </td>
                 <td width="228" >
            	       	  <a onclick="javascript:deptWindowsContactRelationinfo();"> 
					      <custom:button type="2" label="L_Asterisk" imgsrc="flash.gif" border="0" />
				  </a> 
                </td>
                <%} %>
			</tr>




           <%if(!(strDisplayFlag).equals("view")){%>
			<tr>
				<td width="108" class="need"><%= label.getLabelName("L_EmpleoyeeType") + label.getLabelName("L_Colon") %></td>
				<td width="228"><custom:selectdic property="employeetype"
					dictType="EmployeeType" name="userinformation"
					label="L_EmpleoyeeType" command="notnull" defaultValueCost=" "
					defaultValue="-----------" onchange="page_showRow();" /></td>
				<td width="108" class="td-text" id="isbaleLabelId"><%= label.getLabelName("L_YesOrNoBale") + label.getLabelName("L_Colon") %>
				</td>
				<td id="isbaleId"><custom:selectdic property="isbale"
					dictType="YesOrNo" name="userinformation" label="L_YesOrNoBale"
					defaultValueCost=" " defaultValue="-----------"
					onchange="getCheckedYesOrNo()" /></td>

			</tr>
			<tr id="isshow">
				<td width="108" class="need"><%= label.getLabelName("L_UserNumber") + label.getLabelName("L_Colon") %></td>


				<td width="228">
				<input id="codeId" type="text" name="employeecode"
					size="20" onchange="page_checkNullStr(this)"
					value=<%=JspHelper.filterNull(employeeInfo.get("employeecode")) %>>
				</td>
				<td width="108" class="need"><%= label.getLabelName("L_UUserName") + label.getLabelName("L_Colon") %>
				</td>
				<td><custom:text property="employeename" name="userinformation"
					size="20" label="L_EmployeeName" command="notnull"
					onchange="page_checkNullStr(this)" /></td>
			</tr>
			<tr>
				<td class="need" width="108"><%= label.getLabelName("L_GenderName") + label.getLabelName("L_Colon") %></td>
				<td><!-- <oval:select optionsName="allgender" optionValueKey="value" optionInnerTextKey="valuename" name="userinformation" property="gender"/> -->
				<custom:selectdic name="userinformation" property="gender"
					dictType="Gender" valueCriteria="*" defaultValueCost=" "
					defaultValue="-----------" label="L_GenderName" command="notnull"/></td>
				<td class="need" width="108"><%= label.getLabelName("L_TitleName") + label.getLabelName("L_Colon") %></td>
				<td width="228"><!--  <oval:select optionsName="alljobtitle" optionValueKey="value" optionInnerTextKey="valuename" name="userinformation" property="jobtitlecode"/> -->
				<custom:selectdic name="userinformation" property="jobtitlecode"
					dictType="JobTitle" valueCriteria="*" defaultValueCost=" "
					label="L_TitleName" defaultValue="-----------" command="notnull" />
				<!--<custom:selectdic  name="userinformation" property="jobtitlecode" dictType="JobTitle" valueCriteria="*" defaultValueCost=" " label="L_TitleName" defaultValue="-----------" command="notnull"  onchange="isCheckChange();"/>-->
				</td>
			</tr>
			<%}else{ %>
               <tr>
				<td width="108" class="td-text"><%= label.getLabelName("L_EmpleoyeeType") + label.getLabelName("L_Colon") %></td>
				<td width="228"><custom:selectdic property="employeetype"
					dictType="EmployeeType" name="userinformation"
					disabled="true" /></td>
				<td width="108" class="td-text"><%= label.getLabelName("L_YesOrNoBale") + label.getLabelName("L_Colon") %>
				</td>
				<td width="228"><custom:selectdic property="isbale"
					dictType="YesOrNo" name="userinformation" disabled="true" /></td>

			</tr>
			<tr id="isshow">
			<td width="106" class="td-text"><%= label.getLabelName("L_UserNumber") + label.getLabelName("L_Colon") %> </td>
            <td > 
            	&nbsp;<oval:write name="userinformation" property="employeecode"/>
            </td>
				<td width="108" class="td-text"><%= label.getLabelName("L_UUserName") + label.getLabelName("L_Colon") %>
				</td>
				<td>&nbsp;<custom:text property="employeename" name="userinformation"
					size="20" label="L_EmployeeName" command="notnull"
					onchange="page_checkNullStr(this)" /></td>
			</tr>
			<tr>
				<td class="td-text" width="108"><%= label.getLabelName("L_GenderName") + label.getLabelName("L_Colon") %></td>
				<td>
				<custom:selectdic name="userinformation" property="gender"
					dictType="Gender" disabled="true"/></td>
				<td class="td-text" width="108"><%= label.getLabelName("L_TitleName") + label.getLabelName("L_Colon") %></td>
				<td width="228">
				<custom:selectdic name="userinformation" property="jobtitlecode"
					dictType="JobTitle" disabled="true"/>
				<!--<custom:selectdic  name="userinformation" property="jobtitlecode" dictType="JobTitle" valueCriteria="*" defaultValueCost=" " label="L_TitleName" defaultValue="-----------" command="notnull"  onchange="isCheckChange();"/>-->
				</td>
			</tr>
            <%} %>
			<tr>
				<td class="td-text" width="108"><%= label.getLabelName("L_EducationalLevel") + label.getLabelName("L_Colon") %></td>
				<td><!-- <oval:select optionsName="alleducationlevel" optionValueKey="value" optionInnerTextKey="valuename" name="userinformation" property="educationlevelcode"/> -->
				<custom:selectdic name="userinformation"
					property="educationlevelcode" dictType="EducationLevel"
					valueCriteria="*" defaultValueCost=" " defaultValue="-----------" />
				</td>
				<td class="td-text" width="108"><%= label.getLabelName("L_MarriageStatusName") + label.getLabelName("L_Colon") %></td>
				<td width="228"><!-- <oval:select optionsName="allmarriagestatus" optionValueKey="value" optionInnerTextKey="valuename" name="userinformation" property="marriagestatus"/> -->
				<custom:selectdic name="userinformation" property="marriagestatus"
					dictType="MarriageStatus" valueCriteria="*" defaultValueCost=" "
					defaultValue="-----------" /></td>
			</tr>
			<tr>
				
			     <%if(!(strDisplayFlag).equals("view")){%>
			    <td class="td-text" width="108"><%= label.getLabelName("L_Birthday") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="birthday" name="userinformation"
					dataType="date" dataFormat="<%= dateFormat %>"
					onblur="checkdate();" label="L_Birthday"  readonly="true"/> &nbsp;<a
					onclick="javascript:c.show(this,'frm.birthday','<%=dateFormat%>');"><custom:button
					type="3" label="L_Asterisk" imgsrc="Time.gif" border="0" /></a></td>
				<td class="need" width="108"><%= label.getLabelName("L_Begindate") + label.getLabelName("L_Colon") %></td>
				<td width="228"><custom:text property="entrydate" 
					name="userinformation" dataType="date" dataFormat="<%=dateFormat%>"
					label="L_Begindate" command="notnull" readonly="true" onblur="javascript:checkdate()"/>&nbsp;<a
					onclick="javascript:c.show(this,'frm.entrydate','<%=dateFormat%>')"><custom:button
					type="3" label="L_Asterisk" imgsrc="Time.gif" border="0" /></a></td>
			     <%}else{ %>
			    <td class="td-text" width="108"><%= label.getLabelName("L_Birthday") + label.getLabelName("L_Colon") %></td>
				<td>
					&nbsp;<oval:write name="userinformation" property="birthday"/>
				</td>
			    <td class="td-text" width="108"><%= label.getLabelName("L_Begindate") + label.getLabelName("L_Colon") %></td>
				<td width="228">
					 &nbsp;<oval:write name="userinformation" property="entrydate"/>
			    </td>
			     <%} %>
			</tr>
			<tr>
				<td class="td-text" width="108"><%= label.getLabelName("L_IDNumber") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="idcardnumber" name="userinformation"
					size="20" /></td>
				<td class="td-text" width="108"><%= label.getLabelName("L_PrivateBankAccount") + label.getLabelName("L_Colon") %></td>
				<td width="228"><custom:text property="privatebankaccount"
					name="userinformation" size="20" /></td>
			</tr>
			<tr>
			  <%if(!(strDisplayFlag).equals("view")){%>
				<td class="need" width="108"><%= label.getLabelName("L_StatusName") + label.getLabelName("L_Colon") %></td>
				<td>
				<custom:selectdic name="userinformation" property="status"
					dictType="Status" valueCriteria="41,28" command="notnull"
					defaultValue="-------" label="L_StatusName"/></td>
			   <td class="td-text" width="108"><%= label.getLabelName("L_Enddate") + label.getLabelName("L_Colon") %></td>
				<td width="228"><custom:text property="leavedate"
					name="userinformation" dataType="date" dataFormat="<%=dateFormat%>"
					onblur="javascript:checkdate()"  readonly="true"/>&nbsp;<a
					onclick="javascript:c.show(this,'frm.leavedate','<%=dateFormat%>')" /><custom:button
					type="3" label="L_Asterisk" imgsrc="Time.gif" border="0" /></a>
			   </td>
			  <%}else{ %>
			  	<td class="td-text" width="108"><%= label.getLabelName("L_StatusName") + label.getLabelName("L_Colon") %></td>
				<td>
				<custom:selectdic name="userinformation" property="status"
					dictType="Status" /></td>
			    <td class="td-text" width="108"><%= label.getLabelName("L_Enddate") + label.getLabelName("L_Colon") %></td>
			    <td width="228">&nbsp;<oval:write name="userinformation" property="leavedate"/></td>
			  <%} %>
			</tr>
			<tr>
			
                <%if(!(strDisplayFlag).equals("view")){%>
			    <td class="td-text" width="108"><%= label.getLabelName("L_IsUseSystem") + label.getLabelName("L_Colon") %></td>
				<td width="228">
				<custom:hidden property="isusesystem" name="userinformation"/>
				<input type="checkbox" id="isusesystemID" class="normalradio" onclick="setPasswordTable();"
					name="isusesystemflag" value="<%=isusesystem %>">
					
			    </td>
				<td class="need" width="108"><%= label.getLabelName("L_ParentEmp") + label.getLabelName("L_Colon") %></td>
				<td width="300"><custom:text name="userinformation"
					property="parentusername" size="10"
					onchange="page_cleancode('emp')" /> <a
					onclick="javascript:page_selectUser();"><custom:button type="3"
					label="L_Asterisk" imgsrc="flash.gif" border="0" /></a> <custom:text
					name="userinformation" property="parentemployeename" size="10"
					readonly="true" /> <custom:hidden name="userinformation"
					property="parentuserid" command="notnull" label="L_ParentEmp"/> <a
					onclick="javascript:history_watch();"><custom:button type="1"
					label="L_HistoryWatch" imgsrc="finish.gif" border="0"
					style="width:100" /></a></td>
			      <%}else{ %>
			    <td class="td-text" width="108"><%= label.getLabelName("L_IsUseSystem") + label.getLabelName("L_Colon") %></td>
				<td width="228"><!--  <input type="checkbox" id="isusesystemID"
					class="normalradio" 
					name="isusesystem" value="<%=isusesystem %>">-->
					<custom:checkbox  name="userinformation" disabled="true" property="isusesystem"/></td>
			    <td class="td-text" width="108"><%= label.getLabelName("L_ParentEmp") + label.getLabelName("L_Colon") %></td>
				<td width="300">
				&nbsp;<oval:write name="userinformation" property="parentusername"/>
				&nbsp;<oval:write name="userinformation" property="parentemployeename"/></td>
			      <%} %>
			</tr>
			<tr>
			    <%if(!(strDisplayFlag).equals("view")){%>
				<td class="need" width="108"><%= label.getLabelName("L_Sort") + label.getLabelName("L_Colon") %></td>
				<td width="228">
				 <!--<custom:selectdic name="userinformation" property="issalesman" dictType="ServiceAttribute"   defaultValue="-------" label="L_Service_Attribute" disabled="true" />-->
				 &nbsp;<custom:write name="userinformation" property="issalesman" dictType="ServiceAttribute" />
				</td>
			    <td class="need" width="108" id="isBusinessArea"><%= label.getLabelName("L_Provicetdr") + label.getLabelName("L_Colon") %></td>
				<td><custom:hidden name="userinformation" property="businessareaid" label="L_Provicetdr" command="notnull"/>
				<!--<custom:write property="firstareaname" name="userinformation" />&nbsp;
				<custom:write property="secondareaname" name="userinformation" />-->
				<custom:text property="businessareaname" name="userinformation" size="15" label="L_Standard_Business" readonly="true" /> 
				<a onclick="popBusinessarea()"><custom:button type="3" value="*" /></a>
				</td>
			    
			    <%}else{ %>
			   	<td class="td-text" width="106"><%= label.getLabelName("L_Sort") + label.getLabelName("L_Colon") %></td>
				<td width="228">
					 <custom:selectdic name="userinformation" property="issalesman" dictType="ServiceAttribute" disabled="true"/>
			    </td>
				<td class="td-text" width="108"><%= label.getLabelName("L_Standard_Business") + label.getLabelName("L_Colon") %></td>
				<td>
				<custom:write property="businessareaname" name="userinformation" /> 
				</td>
			    <%} %>
				
			</tr>
			<tr>
			<%if(!(strDisplayFlag).equals("view")){%>
			<td class="td-text" width="108"><%= label.getLabelName("L_Product") + label.getLabelName("L_Colon") %></td>
				<td><%-- <oval:text name="glhash" property="accountcode"  size="10" onchange='page_getGLAccountname()'/>--%>
				<a onclick='popWindowsContactProd()'> <custom:button type="3"
					label="L_Asterisk" imgsrc="Time.gif" border="0" /></a> <!-- <oval:text name="glhash" property="accountname"  size="20" readonly="true" />-->
				<oval:hidden name="emplinfo" property="glaccountid" /></td>
				
				<td class="td-text" width="106"><%= label.getLabelName("L_Related_Personnel") + label.getLabelName("L_Colon") %></td>
				<td>
				 <a onclick="javascript:popWindowsContactRelation();">
					<custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0" />
				 </a>
				</td>
			<%}else{ %>
			
				<td class="td-text" width="108"><%= label.getLabelName("L_Product") + label.getLabelName("L_Colon") %></td>
				<td>
				<a onclick='popWindowsContactProdinfo()'> <custom:button type="2"
					label="L_Asterisk" imgsrc="Time.gif" border="0" /></a></td>
				</td>	
				<td class="td-text" width="106"><%= label.getLabelName("L_Related_Personnel") + label.getLabelName("L_Colon") %></td>
				<td>
					<a onclick="javascript:popWindowsContactRelationinfo();"> 
					   <custom:button type="2" label="L_Asterisk" imgsrc="flash.gif" border="0" />
					</a> 
			    </td>
			<%} %>
			</tr>
		    <tr>
				<td class="td-text" width="108"><%= label.getLabelName("L_Userqty") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="userqty" name="userinformation" size="20"  label="L_Userqty"/>
				</td>
				 <%if(!(strDisplayFlag).equals("view")){%>
				<td class="need" width="108"><%= label.getLabelName("L_BusinessType") + label.getLabelName("L_Colon") %></td>
				<td>
				<custom:selectdic name="userinformation" property="businesstype" dictType="ZylBusinessType" defaultValue="-------" command="notnull" label="L_BusinessType" /></td>
				 <%}else{ %>
				<td class="td-text" width="108"><%= label.getLabelName("L_BusinessType") + label.getLabelName("L_Colon") %></td>
				<td>
				<custom:selectdic name="userinformation" property="businesstype"
					dictType="ZylBusinessType" /></td>
				 <%} %>
			</tr>
			<tr>
			<%if(!(strDisplayFlag).equals("view")){%>
				<td class="need" width="108"><%= label.getLabelName("L_Station") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="station" name="userinformation" size="20" command="notnull" label="L_Station"/></td>
				<td class="td-text" width="108"><%= label.getLabelName("L_Adjustable_Hillock_Time") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="adjustdate" name="userinformation"
					dataType="date" dataFormat="<%= dateFormat %>"
					onblur="checkdate();"  readonly="true"/> &nbsp;<a
					onclick="javascript:c.show(this,'frm.adjustdate','<%=dateFormat%>');"><custom:button
					type="3" label="L_Asterisk" imgsrc="Time.gif" border="0" /></a></td>
		     <%}else{ %>
		     <td class="td-text" width="108"><%= label.getLabelName("L_Station") + label.getLabelName("L_Colon") %></td>
		     <td><custom:text property="station" name="userinformation" size="20" command="notnull" label="L_Station"/></td>
		     <td class="td-text" width="108"><%= label.getLabelName("L_Adjustable_Hillock_Time") + label.getLabelName("L_Colon") %></td>
			 <td>&nbsp;<oval:write name="userinformation" property="adjustdate"/></td>
		     <%} %>
			</tr>
			<tr>
			
		     <td class="td-text" width="108"><%= label.getLabelName("L_SpecialM") + label.getLabelName("L_Colon") %></td>
		     <%if(!(strDisplayFlag).equals("view")){%>
				<td>
				<input type="checkbox" name="commentsflag" 	class="normalradio" <%=JspHelper.filterNull( strIscomments )%> ><custom:hidden
					property="comments" name="userinformation"></custom:hidden></td>
			 <%}else{ %>
			 <td>
			 <input type="checkbox" name="commentsflag" 
					class="normalradio" <%=JspHelper.filterNull( strIscomments )%> disabled="true">
				</td>
				<%} %>
				
			<td class="td-text" width="108"><%= label.getLabelName("L_Staffturnovertime") + label.getLabelName("L_Colon") %></td>
		     <%if(!(strDisplayFlag).equals("view")){%>
		     
				<td width="228"><custom:text property="staffturnovertime" 
					name="userinformation" dataType="date" dataFormat="<%=dateFormat%>"
					label="L_Staffturnovertime" readonly="true" onblur="javascript:checkdate()"/>&nbsp;<a
					onclick="javascript:c.show(this,'frm.staffturnovertime','<%=dateFormat%>')"><custom:button
					type="3" label="L_Asterisk" imgsrc="Time.gif" border="0" /></a></td>
			 <%}else{ %>
			 <td width="228">
					 &nbsp;<oval:write name="userinformation" property="staffturnovertime"/>
			    </td>
				<%} %>
			</tr>
		</table>
		<table border="1" cellspacing="0" bordercolorlight="#999999"
			bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="3"
			id="passwordtable" style="display: none;">
			<tr>
				<td colspan="4" class="deepblue-left"><img
					src="../../images/<%= strLanguageCode %>/quote.gif"> <%= label.getLabelName("L_SystemUserInfo") + label.getLabelName("L_Colon") %></td>
			</tr>

			<tr>
				<td width="108" id="pwn" class="td-text"><%= label.getLabelName("L_Password") + label.getLabelName("L_Colon") %></td>
				<td><%
                
                if(haspassword){%> <input type="password"
					name="password0" value="********" id="pwnt"
					onblur="javascript:if(password0.value.indexOf('*')<0)password.value=password0.value;">
				<input type="hidden" name="password"> <%}else{%> <input
					type="password" name="password" id="pwnt" isnull="Y"
					label="<%= message.getMessageDesc("VALUE_NOT_NULL", label.getLabelName("L_Password",false)) %>"></td>
				<%}%>
				<td width="108" id="pwc" class="td-text"><%= label.getLabelName("L_PasswordConfirm") + label.getLabelName("L_Colon") %></td>
				<td width="228"><%if(haspassword){%> <input type="password"
					name="passwordconfirm0" value="********" id="pwct"
					onblur="javascript:if(passwordconfirm0.value.indexOf('*')<0)passwordconfirm.value=passwordconfirm0.value;">
				<input type="hidden" name="passwordconfirm"> <%}else{%> <input
					type="password" name="passwordconfirm" id="pwct" isnull="Y"
					label="<%= message.getMessageDesc("VALUE_NOT_NULL", label.getLabelName("L_PasswordConfirm",false)) %>">
				<%}%></td>
			</tr>
			<tr>
				<td class="td-text" width="108"><%= label.getLabelName("L_PasswordStartDate") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="passwordstartdate" name="userinformation"
					dataType="date" dataFormat="<%=dateFormat%>" onblur="checkdate()"  readonly="true"/><a
					onclick="javascript:c.show(this,'frm.passwordstartdate','<%=dateFormat%>')"><custom:button
					type="3" label="L_Asterisk" imgsrc="Time.gif" border="0" /></a></td>

				<td class="td-text" width="108"><%= label.getLabelName("L_PasswordExpireDate") + label.getLabelName("L_Colon") %></td>
				<td width="228"><custom:text property="passwordexpiredate"
					name="userinformation" dataType="date" dataFormat="<%=dateFormat%>"
					onblur="checkdate()"  readonly="true"/><a
					onclick="javascript:c.show(this,'frm.passwordexpiredate','<%=dateFormat%>')"><custom:button
					type="3" label="L_Asterisk" imgsrc="Time.gif" border="0" /></a></td>
			</tr>
			<tr>
				<td class="td-text" width="108"><%= label.getLabelName("L_PasswordExpireDays") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="passwordexpiredays"
					name="userinformation" size="30" /></td>
				<td class="td-text" width="108"><%= label.getLabelName("L_CanUpdatePassword") + label.getLabelName("L_Colon") %></td>
				<td width="228"><input type="checkbox" name="passwordflag"
					class="normalradio"
					<%=JspHelper.filterNull( strIsCanUpdatePassword )%>> <custom:hidden
					property="canupdatepassword" name="userinformation" /></td>
			</tr>
		</table>
		<table border="1" cellspacing="0" bordercolorlight="#999999"
			bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="3">
			<tr>
				<td colspan="4" class="deepblue-left"><img
					src="../../images/<%= strLanguageCode %>/quote.gif"> <%= label.getLabelName("L_ContactMethod") + label.getLabelName("L_Colon") %></td>
			</tr>
			<tr>
				<td class="td-text" width="108"><%= label.getLabelName("L_Telephone") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="officephone" name="userinformation"
					size="20" label="L_Telephone" /></td>
				<td class="td-text" width="108"><%= label.getLabelName("L_Fax") + label.getLabelName("L_Colon") %></td>
				<td width="228"><custom:text property="faxnumber"
					name="userinformation" size="20" /></td>
			</tr>
			<tr>
				<td class="td-text" width="108"><%= label.getLabelName("L_HomePhone") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="homephone" name="userinformation"
					size="20" /></td>
				<td class="td-text" width="108"><%= label.getLabelName("L_MobilePhone") + label.getLabelName("L_Colon") %></td>
				<td width="228"><custom:text property="mobilephone"
					name="userinformation" size="20" /></td>
			</tr>
			<tr>
				<td class="td-text" width="108">E-mail<%= label.getLabelName("L_Colon") %></td>
				<td><custom:text property="email" name="userinformation" size="20" />
				</td>
				<td class="td-text" width="108"><%= label.getLabelName("L_BPNumber") + label.getLabelName("L_Colon") %></td>
				<td width="228"><custom:text property="bpnumber"
					name="userinformation" size="20" /></td>
			</tr>
		</table>
		<%if(!(strDisplayFlag).equals("view")){%>
		<table border="1" cellspacing="0" bordercolorlight="#999999"
			bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="3">
			<tr>
				<td colspan="4" class="deepblue-left"><img
					src="../../images/<%= strLanguageCode %>/quote.gif"> <%= label.getLabelName("L_HomeAddress") + label.getLabelName("L_Colon") %></td>
			</tr>
			
			<tr>
			
				<td class="need" id="cn" width="108"><%= label.getLabelName("L_CountryName") + label.getLabelName("L_Colon") %></td>
				<td><% String s223 = message.getMessageDesc("VALUE_NOT_NULL", label.getLabelName("L_RegionName",false));
           	if(defaultAddress.get("countrycode")==null){
           	 %> <oval:select optionsName="allcountry"
					optionValueKey="countrycode" optionInnerTextKey="countryname"
					isnull="N" label="<%= s223 %>" name="homeaddress"
					property="countrycode" defaultValue="----------" 
					onchange="javascript:page_changecountry()" /> <%}else{%> <oval:select
					optionsName="allcountry" optionValueKey="countrycode"
					optionInnerTextKey="countryname" isnull="N" label="<%= s223 %>"
					name="homeaddress" property="countrycode"
					onchange="javascript:page_changecountry()" /> <%}%></td>
				<td width="108" id="rn" class="need"><%= label.getLabelName("L_RegionName") + label.getLabelName("L_Colon") %></td>
				<td width="228"><% String s4 = message.getMessageDesc("VALUE_NOT_NULL", label.getLabelName("L_RegionName",false)); %>
				<oval:hidden name="homeaddress" property="regioncode" size="20"
					isnull="N" label="<%= s4 %>" /> <oval:text name="homeaddress"
					property="regionname" readonly="true" size="20" isnull="N"
					label="<%= s4 %>" />&nbsp;<a onclick="selectRegion()"><custom:button
					type="3" label="L_Asterisk" imgsrc="flash.gif" border="0" /></a></td>
			</tr>
			<%
            String strIsNeedCN = "td-text";
            String strIsNeedEN = "td-text";
            String strNullCN = "Y";
            String strNullEN = "N";            
            if(strLanguageCode.equalsIgnoreCase("cn"))
            {
              strIsNeedCN = "need";
              strNullCN = "N";
            }
            if(strLanguageCode.equalsIgnoreCase("en"))
            {
              strIsNeedEN = "need";
              strNullEN = "N";
            }            
          %>

			<tr>
				<td class="need" id="c0" width="104"><%= label.getLabelName("L_CityName") + label.getLabelName("L_Colon") %></td>

				<td colspan="3"><custom:text name="homeaddress" property="cityname"
					size="20" module="MD" label="L_City" needMLC="true"
					isFirstMLC="true" multiLangType="ac" entityId="addressid"
					contentId="addresslangid" colIndex="0" /> <a
					onclick='popup("../../common/Lang.jsp?<%= OvalTools.randomURL() %>&form=frm&module=MD&mlctype=L_City&nativelanguage="+c0.className+"&schema=ovaddresslang&qlname=selectbyaddressid&entityid=<custom:write name="homeaddress" property="addressid"/>&entitytype=ac&contentid=addresslangid&colindex=0", "newwindow", "height=250, width=320,top=100,left=100,toolbar=n0, menubar=no, scrollbars=no, resizable=no, location=no, status=no");'><custom:button
					type="3" label="L_Ln" imgsrc="ln.gif" border="0" /></a></td>
			</tr>
			<tr>
				<td width="108" id="zc" class="need"><%= label.getLabelName("L_ZipCode") + label.getLabelName("L_Colon") %></td>
				<td colspan="3"><% String s7 = message.getMessageDesc("VALUE_NOT_NULL", label.getLabelName("L_ZipCode",false)); %>
				<oval:text name="homeaddress" property="zipcode" size="20"
					isnull="N" label="<%=   s7 %>" /></td>
			</tr>
			<tr>
				<td class="td-text" id="c1" width="104"><%= label.getLabelName("L_AddressLine1") + label.getLabelName("L_Colon") %></td>

				<td colspan="3"><custom:text name="homeaddress"
					property="addressline1" size="77" command="cannull" module="MD"
					label="L_Address" needMLC="true" multiLangType="al1"
					entityId="addressid" contentId="addresslangid" colIndex="0" /> <a
					onclick='popup("../../common/Lang.jsp?<%= OvalTools.randomURL() %>&form=frm&module=MD&mlctype=L_Address&nativelanguage=&schema=ovaddresslang&qlname=selectbyaddressid&entityid=<custom:write name="homeaddress" property="addressid"/>&entitytype=al1&contentid=addresslangid&colindex=0", "newwindow", "height=250, width=320,top=100,left=100,toolbar=n0, menubar=no, scrollbars=no, resizable=no, location=no, status=no");'><custom:button
					type="3" label="L_Ln" imgsrc="ln.gif" border="0" /></a></td>
		</table>
		 <%}else{ %>
		  <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="3">
          <tr> 
            <td colspan="4" class="deepblue-left"><img src="../../images/<%= strLanguageCode %>/quote.gif"> 
            <%= label.getLabelName("L_HomeAddress") + label.getLabelName("L_Colon") %></td>
          </tr>
          <tr> 
            <td class="td-text" id="cn" width="106" ><%= label.getLabelName("L_CountryName") + label.getLabelName("L_Colon") %></td>
            <td > 
           		&nbsp;<oval:write name="homeaddress" property="countryname"/>
            </td>
            <td width="106" id="rn" class="td-text"><%= label.getLabelName("L_RegionName") + label.getLabelName("L_Colon") %></td>
            <td width="228"> 
            	&nbsp;<oval:write name="homeaddress" property="regionname"/>
           </td>
          </tr>
          
  
          <tr> 
            <td class="td-text" id="c0" width="104"><%= label.getLabelName("L_CityName") + label.getLabelName("L_Colon") %></td>
            	
				 <td colspan="3"> 
				 	&nbsp;<oval:write name="homeaddress" property="cityname"/>
				 </td>
          </tr>
          <tr> 
            <td width="106" id="zc" class="td-text"><%= label.getLabelName("L_ZipCode") + label.getLabelName("L_Colon") %></td>
            <td colspan="3" >
            	&nbsp;<oval:write name="homeaddress" property="zipcode"/>
            </td>
          </tr>
          <tr> 
            <td class="td-text" id="c1" width="104"><%= label.getLabelName("L_AddressLine1") + label.getLabelName("L_Colon") %></td>
            	
				  <td colspan="3"> &nbsp;<oval:write name="homeaddress" property="addressline1"/>
		     </td>
        </table>
	      <%} %>
		</td>
	</tr>
	
	<tr>
		<td class="summary_top"></td>
	</tr>
	<!-- 
	<tr>
	
		<td height="60" class="td_center">
			<a onclick="__back();"><custom:button
			type="2" label="L_Back" imgsrc="finish.gif" border="0"
			style="width:60" /></a> 
			  <a onclick="page_jumpToEA();"><custom:button
			type="1" label="L_RelateionMaintain" imgsrc="finish.gif" border="0"
			style="width:60" />
			</a>
			</td>
	</tr>
	 -->
      <td class="td_center">
	    <a onclick="__back()"><custom:button type="2" label="L_Back" imgsrc="delete.gif" border="0" style="width:60"/></a>
      </td>		
    </tr>
	</form>

</table>
<script>
  //var popwindow;
  function page_jumpToEA(){
  userid = frm.userid.value;
  self.location='<%=contextPath%>/masterdata/map/EmployeeAreaMap.jsp?first=1&second=101&third=10213&languagecode=cn&userid='+userid;
  }
  changeAddress();
  showPassword();
</script>
<script type="text/javascript">
<% if("11".equals(Strisplay)) {%>
document.getElementById("isshow").style.display = "block";
<% if(employeeTypeValue.intValue() ==1){ %>

document.getElementById("codeId").style.border = "1px solid #7F9DB9";
<%}else{%>
 document.getElementById("codeId").style.border = "0px solid ";
 document.getElementById("codeId").readOnly = true;
<%}}else{%>
document.getElementById("isshow").style.display = "none";
<% }%>
</script>
<script>
  var list=document.getElementsByTagName("input");
  m=list.length
  list[m-1].style.display='none';
</script>
</body>
</html>
